import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ThreadPoolDemo7 {
    public static void main(String[] args) {
        ExecutorService service=Executors.newSingleThreadScheduledExecutor();
        for (int i = 0; i <10 ; i++) {
            int finalI = i;
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println("任务："+ finalI +"线程名:"+Thread.currentThread().getName());
                }
            });
        }
    }
}
